package lc_3111_覆盖所有点的最少矩形数目;

import java.util.Arrays;
import java.util.Collections;

public class Solution {
    public int minRectanglesToCoverPoints(int[][] points, int w) {
        Arrays.sort(points, (a, b) -> a[0] - b[0]);
        int ans = 0, r = -1;
        for (int[] p : points) {
            int x = p[0], y = p[1];
            if (x > r) {
                ans += 1;
                r = x + w;
            }
        }
        return ans;
    }
}